﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cooc
{
    public class LogUtil
    {
        FileStream logg;
        BinaryWriter writer;

        public LogUtil(FileStream logStream)
        {
            logg = logStream;
            writer = new BinaryWriter(logg);
        }

        public void info(string message)
        {
            WritePerfix("INFO", message);
        }

        public void warning(string message)
        {
            WritePerfix("WARNING", message);
        }

        public void error(string message)
        {
            WritePerfix("ERROR", message);
        }

        public void WritePerfix(string type, string message)
        {
            WriteLine("[" + type + "] " + message);
        }

        public void WriteLine(string message)
        {
            writer.Write(message + "\r\n");
            Console.WriteLine(message);
        }
    }
}
